﻿package {
	import flash.display.*;
	
	public class Room extends Sprite {

		var rectangle = new Sprite();
				
		public function Room() {
			init();	
		}
		
		public function init() {
			initSprite();
		}
		
		public function initSprite()
		{
			rectangle.graphics.lineStyle(2, 0xCCCCCC, 0);
			rectangle.graphics.drawRect(0, 0, 600, 600);
			rectangle.graphics.endFill();
			addChild(rectangle);
		}

		public function clearContents()
		{
			for (var i = this.numChildren-1; i >= 0; i--)
			{
				if (getChildAt(i) != rectangle)
				{
					trace("removing child "+i+" "+getChildAt(i).name);//TMP
					removeChild(getChildAt(i));
				}
			}
		}
		
		public function add(child)
		{
			addChild(child);
			child.setRoom(this);
		}
		
		public function remove(child)
		{
			removeChild(child);
			child.setRoom(null);
		}
		
	}
}